//
// Created by Nasa on 2024-2-10.
// 素数埃氏筛法
//


#include <cmath>
#include <iostream>

using namespace std;

int main()
{
    int n = 100; // out: 25
    n = 1740948; // out: 130971
    n = 1152761; // out: 89503
    n = 2795431; // out: 203047
//    n= 2115790; //out:156902
//    n = 4974953; // out: 346862
//    cin>>n;
    int c = 0;
    bool l[n + 1];
    l[0] = false;
    l[1] = false;
    for (int i = 2; i < n; ++i)
    {
        l[i] = true;
    }
    for (int i = 2; i < int(sqrt(n)) + 1; ++i)
    {
        if (l[i])
        {
            for (int j = i+i; j <= n; j += i)
            {
//                if (j > i)
                {
                    l[j] = false;
                }
            }
        }
    }
    for (int i = 2; i <= n; ++i)
    {
        if (l[i])
        {
            c++;
        }
    }
    cout << c;
    return 0;
}